package events

import (
	"time"
)

// 用户相关事件类型常量
const (
	UserCreatedEventType    = "user.created"
	UserUpdatedEventType    = "user.updated"
	UserDeletedEventType    = "user.deleted"
	UserLoggedInEventType   = "user.logged_in"
	UserLoggedOutEventType  = "user.logged_out"
	UserPasswordChangedType = "user.password_changed"
	UserStatusChangedType   = "user.status_changed"
	UserRoleChangedType     = "user.role_changed"
)

// UserCreatedEvent 用户创建事件
type UserCreatedEvent struct {
	ID        uint      `json:"id"`
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Nickname  string    `json:"nickname"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"created_at"`
}

// UserUpdatedEvent 用户更新事件
type UserUpdatedEvent struct {
	ID        uint      `json:"id"`
	Username  string    `json:"username"`
	Nickname  string    `json:"nickname"`
	Avatar    string    `json:"avatar"`
	UpdatedAt time.Time `json:"updated_at"`
}

// UserDeletedEvent 用户删除事件
type UserDeletedEvent struct {
	ID        uint      `json:"id"`
	Username  string    `json:"username"`
	DeletedAt time.Time `json:"deleted_at"`
}

// UserLoggedInEvent 用户登录事件
type UserLoggedInEvent struct {
	ID        uint      `json:"id"`
	Username  string    `json:"username"`
	IP        string    `json:"ip"`
	UserAgent string    `json:"user_agent"`
	LoginAt   time.Time `json:"login_at"`
}

// UserLoggedOutEvent 用户登出事件
type UserLoggedOutEvent struct {
	ID       uint      `json:"id"`
	Username string    `json:"username"`
	LogoutAt time.Time `json:"logout_at"`
}

// UserPasswordChangedEvent 用户密码修改事件
type UserPasswordChangedEvent struct {
	ID        uint      `json:"id"`
	Username  string    `json:"username"`
	ChangedAt time.Time `json:"changed_at"`
}

// UserStatusChangedEvent 用户状态修改事件
type UserStatusChangedEvent struct {
	ID             uint      `json:"id"`
	Username       string    `json:"username"`
	PreviousStatus int       `json:"previous_status"`
	CurrentStatus  int       `json:"current_status"`
	ChangedAt      time.Time `json:"changed_at"`
}

// UserRoleChangedEvent 用户角色修改事件
type UserRoleChangedEvent struct {
	ID           uint      `json:"id"`
	Username     string    `json:"username"`
	PreviousRole string    `json:"previous_role"`
	CurrentRole  string    `json:"current_role"`
	ChangedAt    time.Time `json:"changed_at"`
}
